package ru.isys.yoomee.model;

import java.io.Serializable;

public class Yoo implements Serializable{
	private String nickName;
	private int distanceToYou;
	private String registeredAgo;
	private String lastCheckinAgo;
	private Venue lastCheckinVenue;
	private boolean sex;

	public Yoo(String nickName, int distanceToYou, int registeredAgo, boolean sex) {
		this.nickName = nickName;
		this.distanceToYou = distanceToYou;
		this.registeredAgo = registeredAgo + " month ago";
		this.sex=sex;
	}

	public Yoo(String nickName) {
		this(nickName, 0, 0, true);
	}

	public String getNickName() {
		return nickName;
	}

	public void setNickName(String nickName) {
		this.nickName = nickName;
	}

	public int getDistanceToYou() {
		return distanceToYou;
	}

	public String getDistanceToYouString() {
		return distanceToYou + " km";
	}

	public void setDistanceToYou(int distanceToYou) {
		this.distanceToYou = distanceToYou;
	}

	public String getRegisteredAgo() {
		return registeredAgo;
	}

	public void setRegisteredAgo(String registeredAgo) {
		this.registeredAgo = registeredAgo;
	}

    public Venue getLastCheckinVenue()
    {
        return lastCheckinVenue;
    }

    public void setLastCheckinVenue(Venue lastCheckinVenue)
    {
        this.lastCheckinVenue = lastCheckinVenue;
    }

    public String getLastCheckinAgo()
    {
        return lastCheckinAgo;
    }

    public void setLastCheckinAgo(String lastCheckinAgo)
    {
        this.lastCheckinAgo = lastCheckinAgo;
    }

	public boolean getSex() {
		return sex;
	}

	public void setSex(boolean sex) {
		this.sex = sex;
	}

    @Override
    public int hashCode()
    {
        final int prime = 31;
        int result = 1;
        result = prime * result + distanceToYou;
        result = prime * result + ((lastCheckinAgo == null) ? 0 : lastCheckinAgo.hashCode());
        result = prime * result + ((lastCheckinVenue == null) ? 0 : lastCheckinVenue.hashCode());
        result = prime * result + ((nickName == null) ? 0 : nickName.hashCode());
        result = prime * result + ((registeredAgo == null) ? 0 : registeredAgo.hashCode());
        result = prime * result + (sex ? 1231 : 1237);
        return result;
    }

    @Override
    public boolean equals(Object obj)
    {
        if (this == obj)
            return true;
        if (obj == null)
            return false;
        if (getClass() != obj.getClass())
            return false;
        Yoo other = (Yoo) obj;
        if (distanceToYou != other.distanceToYou)
            return false;
        if (lastCheckinAgo == null)
        {
            if (other.lastCheckinAgo != null)
                return false;
        }
        else if (!lastCheckinAgo.equals(other.lastCheckinAgo))
            return false;
        if (lastCheckinVenue == null)
        {
            if (other.lastCheckinVenue != null)
                return false;
        }
        else if (!lastCheckinVenue.equals(other.lastCheckinVenue))
            return false;
        if (nickName == null)
        {
            if (other.nickName != null)
                return false;
        }
        else if (!nickName.equals(other.nickName))
            return false;
        if (registeredAgo == null)
        {
            if (other.registeredAgo != null)
                return false;
        }
        else if (!registeredAgo.equals(other.registeredAgo))
            return false;
        if (sex != other.sex)
            return false;
        return true;
    }
}
